#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
using namespace std;

class Solution {
public:
    int subarraysDivByK(vector<int>& nums, int k) {
        unordered_map<int, int> hash;
        int sum = 0, ret = 0;
        hash[0] = 1;
        for (auto& num : nums)
        {
            sum += num;
            int tmp = sum % k;
            if (tmp < 0) tmp += k;
            if (hash.count(tmp)) ret += hash[tmp];
            hash[tmp]++;
        }
        return ret;
    }
};

int main() {
    return 0;
}